(function($){
	// alert(typeof jQuery); // alerts 'Some string to translate'
	
	$(function(){
		if($('ul#tips-flow').length > 0 ) {
			$('ul#tips-flow').roundabout({
				'btnPrev' : 'span#btnPrev a',
				'btnNext' : 'span#btnNext a',
				'minOpacity' : 0.6,
				'minScale' : 0.6
			});
		}
	});
  
})( jQuery );



function jsonGetPostContent(post_idx, container) {
	// Get post ID from post_idx
	
	var post_id = posts_index.data[post_idx];
	
	var $api_url = "";
	$api_url = singcrets_global_vars.siteurl + "/?p=" + post_id + "&json=1";
	
	/*
	console.info($api_url);
	console.info("post_id");
	console.info(post_id);
	*/
	var post = new Object();
	
	jQuery.get($api_url, function(data){
		//console.info (data);
        /*
		
		console.info (data);
		console.info ("container");
		console.info (container);
		*/
		if((typeof (data.post.attachments[0]) != 'undefined') && (typeof (data.post.attachments[0].images["home-thumb"]) != 'undefined')) {
			post.image_url = data.post.attachments[0].images["home-thumb"].url;
		} else {
			post.image_url = posts_index.default_img;
		}
		post.title = data.post.title;
		post.content = data.post.content;
		if(data.post.tags.length > 0) {
			post.tag = data.post.tags[0].title;
		} else if(data.post.categories.length > 0){
			post.tag = data.post.categories[0].title;
		} else post.tag = 'Other';
		
		// console.info(post);
		
		
		// processTemplate(post)
		// jQuery(container).find("div[id*=post-1] .col-1").innerHTML
		
		jQuery(container).find("div[id*=post-" + post_idx + "] .col-1").html("<div class=\"ribbon-wrapper-green\"><div class=\"ribbon-green\">" + post.tag + "</div></div><img src='" + post.image_url +  "' alt='' /> <p>" + post.title + "</p>");
		jQuery(container).find("div[id*=post-" + post_idx + "] .col-2").html(post.content);
		//jQuery(post.content).appendTo(jQuery(container).find("div[id*=post-" + post_idx + "] .col-2"));
		
		// Cufon.refresh();
		
		jQuery(container).find("div[id*=post-" + posts_index.current_idx + "]").css('display', 'block');
	});

	
}


